package thread;
/**
 *可以写个Runnable，对其传参数
 */


public class PrintABC {
	static int count=0;
	public static void main(String[] args) {
		
		new Thread(){
			@Override
			public void run() {
				while(count<9){
					if(count%3==0){
						System.out.println('A');
						count++;
					}
					Thread.yield();
				}
			}
		}.start();
		new Thread(){
			@Override
			public void run() {
				while(count<9){
					if(count%3==1){
						System.out.println('B');
						count++;
					}
					Thread.yield();
				}
			}
		}.start();
		new Thread(){
			@Override
			public void run() {
				while(count<9){
					if(count%3==2){
						System.out.println('C');
						count++;
					}
					Thread.yield();
				}
			}
		}.start();
	}
}


//public class PrintABC{
//public static void main(String[] args) {
//	new Thread(new PrintChar('A', 3)).start(); 
//	new Thread(new PrintChar('B', 3)).start(); 
//	new Thread(new PrintChar('C', 3)).start(); 
//}
//}